package com.yonyou.pmclouds.plan.entity;

import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.measureindex.entity.MeasureIndexHistoryVO;
import lombok.Data;

import javax.persistence.Transient;
import java.util.Date;

@Data
public class ProjectPlanViewVO extends SuperVO {
    public static final String PK_PLAN = "pkPlan";
    public static final String DEPEND_PLAN = "dependPlan";
    public static final String EXPE_START_DATE = "expeStartDate";
    public static final String EXPE_END_DATE = "expeEndDate";
    public static final String EXPE_DURATION = "expeDuration";
    public static final String DESCRIPTION = "description";
    public static final String MANAGER = "manager";
    public static final String MANAGER_NAME = "managerName";
    public static String CREATOR = "creator";
    public static String CREATOR_NAME = "creatorName";
    public static final String PLAN_FINISHER = "planFinisher";
    public static final String PLAN_FINISHER_NAME = "planFinisherName";

    private String pkPlan;
    private String pkTenant;
    private String pkProject;
    private String sname;
    private String scode;
    /**
     * 顺序号,记录当前层级该节点的顺序
     */
    private int seq;
    /**
     * 前置计划
     */
    private String dependPlan;
    private String dependPlanName;
    /**
     * 计划开始日期
     */
    private Date expeStartDate;
    /**
     * 计划结束日期
     */
    private Date expeEndDate;
    private Date startDate;
    private Date endDate;
    private Date firstSubmitDate;
    private Date lastSubmitDate;
    /**
     * 工期
     */
    private int expeDuration;
    /**
     * 描述
     */
    private String description;
    /**
     * 根节点
     */
    private String pkParent;
    private String pkRoot;
    private Integer childCount;
    private String creator;
    private Date creationtime;
    private String modifier;
    private Date modifytime;

    private String[] pictures;
    private Integer progress;
    // 由view层定义的executeDate，执行日期
    private Date executeStartDate;
    private Date executeEndDate;
    private ProjectPlanViewVO[] child;
    /**
     *  判断是否全部任务项没有负责人
     */
    private Boolean noManagerFlag = true;
    /**
     * 负责人
     */
    private String manager;
    private byte billstatus;
    private String pkSrc;
    private int version;
    private String lastFlag;

    /**
     * 指标数
     */
    private Integer indexNumber;
    /**
     * 关联里程碑
     */
    private String pkMilestone;
    private String milestoneName;
    private String milestoneStatus;

    /**
     *  是否延期
     */
    private Boolean isExtension = false;

    /**
     *  是否nc单据
     */
    private Boolean isNcBill = false;


    /**
     * 关联单据类型
     */
    private String relatedBillType;
    private String relatedBillTypeName;
    private String relatedPkBill;

    /**
     * nc部门
     */
    private String pkDepartment;
    private String departmentName;
    /**
     * 计划进度完成状态
     */
    private Byte completedStatus;
    /**
     * 计划完成人
     */
    private String planFinisher;

    /**
     *  关联指标记录信息 用于app端展示
     */

    private MeasureIndexHistoryVO[] measureIndexHistoryVOS;
    //用于web端列表展示
    private String key;
    private ProjectPlanViewVO[] children;
    private byte projectState;
    @Transient
    private String managerName;
    @Transient
    private String creatorName;
    @Transient
    private Double doubleProgress;
    @Transient
    private String planFinisherName;

    /** 用于统计分析展示 */
    @Transient
    private String projectCode;
    @Transient
    private String projectName;
    @Transient
    private String projectManager;
    @Transient
    private Boolean isKey;
    @Transient
    private String pkOrg;

    @Transient
    private String failedCommit;
    @Transient
    private String pkPlanwrite;//计划填报主键,查询审批记录时用
    @Transient
    private byte status;//计划填报的审批状态展示字段
    @Transient
    private String mark;//计划展示不展示标记
    public static ProjectPlanViewVO convertVO(ProjectPlanVO plan) {
        ProjectPlanViewVO vo = new ProjectPlanViewVO();
        vo.setChildCount(plan.getChildCount());
        vo.setCreationtime(plan.getCreationtime());
        vo.setCreator(plan.getCreator());
        vo.setDependPlan(plan.getDependPlan());
        vo.setDependPlanName(plan.getDependPlanName());
        vo.setDescription(plan.getDescription());
        vo.setExpeDuration(plan.getExpeDuration());
        vo.setExpeEndDate(plan.getExpeEndDate());
        vo.setExpeStartDate(plan.getExpeStartDate());
        vo.setModifier(plan.getModifier());
        vo.setModifytime(plan.getModifytime());
        vo.setPkParent(plan.getPkParent());
        vo.setPkPlan(plan.getPkPlan());
        vo.setPkRoot(plan.getPkRoot());
        vo.setPkProject(plan.getPkProject());
        vo.setPkTenant(plan.getPkTenant());
        vo.setScode(plan.getScode());
        vo.setSeq(plan.getSeq());
        vo.setSname(plan.getSname());
        vo.setChangeFlag(plan.getChangeFlag());
        vo.setDr(plan.getDr());
        vo.setProgress(0);
        vo.setPictures(plan.getPictures());
        vo.setManager(plan.getManager());
        vo.setBillstatus(plan.getBillstatus());
        vo.setPkSrc(plan.getPkSrc());
        vo.setVersion(plan.getVersion());
        vo.setLastFlag(plan.getLastFlag());
        vo.setPkPlanwrite(plan.getPkPlanwrite());
        vo.setStatus(plan.getStatus());
        vo.setMark(plan.getMark());
        vo.setIndexNumber(plan.getIndexNumber());
        vo.setPkMilestone(plan.getPkMilestone());
        vo.setRelatedBillType(plan.getRelatedBillType());
        vo.setPkDepartment(plan.getPkDepartment());
        vo.setCompletedStatus(plan.getCompletedStatus());
        vo.setPlanFinisher(plan.getPlanFinisher());
        vo.setRelatedPkBill(plan.getRelatedPkBill());
        return vo;
    }
}
